#include "StdAfx.h"
#include "ACPIEventSink.h"

CACPIEventSink::CACPIEventSink(void)
: m_hMsgWnd(NULL)
{
}

CACPIEventSink::CACPIEventSink(HWND hWnd)
: m_hMsgWnd(hWnd)
{
}

CACPIEventSink::~CACPIEventSink(void)
{
}

HRESULT CACPIEventSink::Indicate(long lObjectCount,
    IWbemClassObject **apObjArray)
{
	HRESULT hres = S_OK;

  for (int i = 0; i < lObjectCount; i++)
  {
    PostMessage(m_hMsgWnd, WM_MYWMIMSG, WMIMSG_INDICATE, 0);
  }

  return WBEM_S_NO_ERROR;
}

HRESULT CACPIEventSink::SetStatus(
            /* [in] */ LONG lFlags,
            /* [in] */ HRESULT hResult,
            /* [in] */ BSTR strParam,
            /* [in] */ IWbemClassObject __RPC_FAR *pObjParam
        )
{
  if(lFlags == WBEM_STATUS_COMPLETE)
  {
    PostMessage(m_hMsgWnd, WM_MYWMIMSG, WMIMSG_STATUS_COMPLETE, 0);
  }
  else if(lFlags == WBEM_STATUS_PROGRESS)
  {
    PostMessage(m_hMsgWnd, WM_MYWMIMSG, WMIMSG_STATUS_IN_PROGRESS, 0);
  }

  return WBEM_S_NO_ERROR;
}
